package com.atguigu.realtime.util;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Author lizhenchao@atguigu.cn
 * @Date 2022/2/14 14:19
 */
public class ThreadPoolUtil {
    public static ThreadPoolExecutor getThreadPool() {
        return new ThreadPoolExecutor(
            300, // 线程池中核心线程的数量
            500, // 线程池中最多运行运行的线程数
            30, // 超过核心数量的线程空闲的时间, 然后销毁空闲的线程
            TimeUnit.SECONDS,
            new LinkedBlockingDeque<>(100)
        );
    }
}
